
// AJAX service object for linked lists
function sys_ajax_linked_lists()
{
	this.target = '';
	this.callback = '';
	return this;
}
	sys_ajax_linked_lists.prototype.invoke=function(callback, value, target)
	{
		this.target = target;
		this.callback = callback + '&pid=' + value;

		var ajax = new sys_ajax();
		return ajax.send(this);
	}

	sys_ajax_linked_lists.prototype.process=function(docXML)
	{
		var options = docXML.getElementsByTagName('option');
		var target = document.forms.post[this.target];

		// clear the list
		while ( child = target.lastChild )
		{
			target.removeChild(child);
		}
		var selected = false;
		for ( var i = 0; i < options.length; i++ )
		{
			selected = options[i].getAttribute('selected') && (options[i].getAttribute('selected') == 'selected');
			disabled = options[i].getAttribute('disabled') && (options[i].getAttribute('disabled') == 'disabled');
			target.options[i] = new Option(options[i].firstChild.data, options[i].getAttribute('value'), selected);
			if ( disabled )
			{
				target.options[i].disabled = 'disabled';
			}
		}
	}
